using System.Linq;
using WorkbookDesigner.Addons.SpreadsheetEditor.Presenter;

namespace WorkbookDesigner.Addons.SpreadsheetEditor.Model
{
    public sealed class ActionDeletePrompt : ActionModel
    {
        public ActionDeletePrompt(PromptModel template) : base(OpType.Delete)
        {
            Template = template;
        }

        public override void Execute(IMission m)
        {
            var list = m.GetPromptList(false);
            var p = list.FirstOrDefault(x => x.Name == Template.Name);
            p?.Delete();
        }
    }
}